<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/6
 * Time: 10:49
 */

if(!empty($_COOKIE['Token'])){
    echo '你的用户编号为:'.$_COOKIE['Token'];
}
echo '<br />';
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>用户中心</title>
</head>
<body>
    <label>上传头像</label>
    <br />
    <form action="uploadImg.php" method="post" enctype="multipart/form-data">
        <label>请选择图片</label>
        <input type="file" id="file" name="file" value="" multiple="multiple" />
        <br />
        <img src="" id="show">
        <br />
        <input type="submit" id="" value="提交" />
    </form>
</body>
<script type="text/javascript">
    var fileObj = document.getElementById('file');
    function show(){
        var files = fileObj['files'];
        var URL = window.URL || window.webkitURL;
        var imgURL = URL.createObjectURL(files[0]);
        document.getElementById('show').src=imgURL;
    }
    onload = function(){
        console.log(fileObj);
        fileObj.onchange = show;
    }
</script>
</html>
